// ActionScript file
package{
	public class Greeter{
		public static var validNames:Array = ['Pedro', 'Luis', 'Juan'];
		
		public function sayHello(userName:String=''):String{
			var greeting:String;
			if(userName==''){
				greeting = 'Hello. Type your user name and then press the enter key';
			} else if(validName(userName)){
				greeting = 'Hello ' + userName;
			} else {
				greeting = 'Sorry--- ' + userName + ', you are no in the list';
			}
			return greeting;
		}
		
		public static function validName(inputName:String):Boolean{
			if(validNames.indexOf(inputName)> -1){
				return true;
			} else {
				return false;
			}
		}
	}
}